package com.spi.service;

import com.spi.config.MyWebSocketHandler;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class AsyncService {

    @Async
    public void doLongTask(String sessionId) {
        try {
            // 模拟耗时操作
            Thread.sleep(5000);
            MyWebSocketHandler.sendMessageToClient(sessionId, "后台处理完成111");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
